package handlers



func BuildSuccessResp(data interface{})*response {
	return &response{
		State:   true,
		Code:    SuccessCode,
		Data:    data,
		Message: SuccessMsg,
	}
}

func BuildServerErrResp()*response {
	return BuildFailResp(ServerErrorCode,ServerErrorMsg)
}

func BuildArgsErrResp()*response {
	return BuildFailResp(ArgsErrorCode,ArgsErrorMsg)
}

func BuildFailResp(code int32,errMsg string)*response {
	return &response{
		State:false,
		Code:code,
		Data:nil,
		Message:errMsg,
	}
}



//返回码
const (
	//通用返回码
	SuccessCode     =1000
	ArgsErrorCode   =1001
	ServerErrorCode =1999
)

//描述
const(
	SuccessMsg="成功"
	ServerErrorMsg="服务内部错误"
	ArgsErrorMsg="请求参数有误"
)

//业务类型
const(
	FileNotFoundCode=2000
	FileNotFoundMsg="找不到文件"

	BlockIncompleteCode=3000
	BlockIncompleteMsg="分块文件不全"

)